package com.jdcy.model.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jdcy.model.dao.DepartmentsMapper;
import com.jdcy.model.entity.Departments;
import com.jdcy.model.service.DepartmentsServcie;

@Service
@Transactional
public class DepartmentsServcieImpl implements DepartmentsServcie {

	@Autowired
	private DepartmentsMapper departmentsMapper;

	@Override
	public int add(Departments t) {
		return departmentsMapper.insertSelective(t);
	}

	@Override
	public int update(Departments t) {
		return departmentsMapper.updateByPrimaryKeySelective(t);
	}

	@Override
	public int delete(Integer id) {
		return departmentsMapper.deleteByPrimaryKey(id);
	}

	@Override
	public Departments queryById(Integer id) {
		return departmentsMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Departments> query() {
		return departmentsMapper.query();
	}

}
